<?php

namespace backend\models;

use Yii;

/**
 * This is the model class for table "tba_membeaddrinfo".
 *
 * @property integer $ID
 * @property integer $TBa_ID
 * @property string $username
 * @property string $RecMan
 * @property string $Tel
 * @property string $RecAddress
 * @property string $PostCode
 * @property integer $IsDefault
 *
 * @property TbaMemberinfo $tBa
 */
class TbaMembeaddrinfo extends \yii\db\ActiveRecord
{
    /**
     * @inheritdoc
     */
    public static function tableName()
    {
        return 'tba_membeaddrinfo';
    }

    /**
     * @inheritdoc
     */
    public function rules()
    {
        return [
            [['TBa_ID', 'IsDefault'], 'integer'],
            [['RecMan', 'Tel', 'RecAddress', 'PostCode'], 'required'],
            [['username', 'RecMan', 'Tel'], 'string', 'max' => 20],
            [['RecAddress'], 'string', 'max' => 150],
            [['PostCode'], 'string', 'max' => 6]
        ];
    }

    /**
     * @inheritdoc
     */
    public function attributeLabels()
    {
        return [
            'ID' => 'ID',
            'TBa_ID' => 'Tba  ID',
            'username' => 'Username',
            'RecMan' => 'Rec Man',
            'Tel' => 'Tel',
            'RecAddress' => 'Rec Address',
            'PostCode' => 'Post Code',
            'IsDefault' => 'Is Default',
        ];
    }

    /**
     * @return \yii\db\ActiveQuery
     */
    public function getTBa()
    {
        return $this->hasOne(TbaMemberinfo::className(), ['ID' => 'TBa_ID', 'username' => 'username']);
    }
}
